//
//  ArqKeyRel.h
//  arq
//
//  Created by xiao wen on 15/1/20.
//  Copyright (c) 2015年 witsi. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "DataTransmitImp.h"

@interface ArqKeyRel : NSObject{
@private
    void *pCppObj;
}


- (id)initWith:(DataTransmitImp*)dataTransmit;


-(int) clearAllKeyGroups;
-(int) clearSpeKeyGroupFid:(int)fid gid:(int)gid;
-(int) importMainKeyGroupFid:(int)fid gid:(int)gid keys:(NSData*)keybuf verify:(NSData*)verbuf val:(NSData*)valbuf;
-(int) importWorkKeyGroupFid:(int)fid gid:(int)gid type:(int)wktype keys:(NSData*)keybuf verify:(NSData*)verbuf val:(NSData*)valbuf;
-(int) setCurKeyGroupFid:(int)fid gid:(int)gid;
-(int) getCurKeyGroup:(NSData**)retbuf;

/*
 * parameter:
 * type ----- key type.
 * gid ------ key group id.
 * stabuf ---- buffer to return key group status.
 *         stabuf[0]: key group status:
 *                        bit0 ---- 1: main key exist.
 *                        bit1 ---- 1: PIN key exist.
 *                        bit2 ---- 1: MAC key exist.
 *                        bit3 ---- 1: MAG key exist.
 *                        bit4 ---- 1: private key exist.
 * return:
 * = 0: success.
 * -1: io error happened.
 * -2: bad args.
 * -3: invalid key type.
 * -4: invalid key group id.
 * -5: unknown error!
 * -30xx: reference to <Witsi Communication protocol.doc> Appendix 2
 */
-(int) getKeyGroupStatusFid:(int)fid gid:(int)gid returnStatus:(Byte*)status;

-(int) keyInjection;
-(int) crlInjection;
-(int)importDukptKeyGroup:(int)gid withStrKeyBuf:(NSData*)keybuf withStrCheckData:(NSData*)checkData
        withStrCheckValue:(NSData*)checkValue withStrKsn:(NSData*)ksn
      withStrKsnCheckData:(NSData*)ksnCheckData withStrKsnCheckValue:(NSData*)ksnCheckValue;
-(int)getCurrKsn:(NSData**)ksn;

@end